home *** CD-ROM | disk | FTP | other *** search
- Path: utpapa.ph.utexas.edu!tian
- From: tian@utpapa.ph.utexas.edu (Shiyang Tian)
- Newsgroups: comp.lang.c++
- Subject: [help] 3D Array class
- Date: 24 Jan 1996 18:07:04 GMT
- Organization: Physics Department, University of Texas at Austin
- Message-ID: <4e5sg8$r4h@geraldo.cc.utexas.edu>
- NNTP-Posting-Host: utpapa.ph.utexas.edu
-
- Hi,
-
- I'd like to construct a 3D array class which can take negative indices.
- What's the best way to do it? A related question: is it possible to
- overload operator [][][] so that I can write something like following?
-
- class array3D { ... };
-
- array3D x;
- array3D *y;
-
- y = new array3D(X, Y. Z); // index for y is from -X to X, ...
- (*y)[1][2][-3] = x[-1][-2][3];
-
- Any pointer is greatly appreciated!
-
- -- Tian
-